package org.example.fboot.result;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.io.Serializable;


@Getter
@AllArgsConstructor
public enum RequestStat implements Serializable {
    ok(2000, null),
    login(2001, "登录成功"),
    account_exception(4000, "账户状态异常"),
    logout(4001, "退出登录"),
    token_invalid(4002, "token无效或已过期"),
    auth_invalid(4003, "访问未授权"),
    token_out_time(4004, "token过期"),
    user_password_error(4005, "用户不存在或者密码错误"),
    un_login(4006, "用户未登录"),
    not_found(4040, "页面不存在"),
    user_lock(4007, "用户被锁定"),
    run_error(5000, "服务器异常"),
    method_argument(5001, "接口参数校验异常"),
    bus_error(5002, "业务异常"),
    ;

    public final int code;
    public final String msg;

    @Override
    public String toString() {
        return String.format("""
                {
                    "code": %d,
                    "msg" : "%s"
                }
                """,this.code,this.msg);
    }

}
